// See https://aka.ms/new-console-template for more information

using ThreadExercise;
using ThreadExercise.methods;



//Counter counter  = new Counter();
//Thread t1 = new Thread(DeadLock.DeadLockTest);
//t1.Name = "线程1";
//Thread t2 = new Thread(DeadLock.DeadLockTest);
//t2.Name = "线程2";

//t1.Start();
//t2.Start();

//t1.Join();
//t2.Join();


//Thread threadWithCustomObject = new Thread(ThreadMethod.DoWorkWithCustomObject);
//People people = new People()
//{
//    name = "Test",
//    age = 10,
//    sex = "女"
//};

//threadWithCustomObject.Start("123");
//threadWithCustomObject.Join();


//Thread threadWithParam = new Thread(ThreadMethod.DoWorkWithTimes);
//threadWithParam.Start(5);
//threadWithParam.Join();
//threadWithParam.Start(5);
//threadWithParam.Join();


//Thread threadWithParam = new Thread(ThreadMethod.DoWorkWithParam);
//threadWithParam.Start("Hello Thread");
//threadWithParam.Join(); 


//传递一个包含零或一个参数的委托
Thread thread = new Thread(ThreadMethod.DoWork);
thread.Start();

//for(int i = 0;i < 5; i++)
//{
//    Console.WriteLine($"主线程：{i}");
//    Thread.Sleep(100);
//}

thread.Join();
Console.WriteLine("所有线程执行完毕");

